// 引入ElementPlusIconsVue
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 需要全局引入一些组件，如ElLoading，不然一些样式有问题
import { ElLoading } from 'element-plus'
import 'element-plus/theme-chalk/el-loading.css'

// 引入ElementPlus响应式布局
import 'element-plus/theme-chalk/display.css'

const plugins = [ElLoading]

export const setupElementPlus = (app) => {
  // 注册ElementPlusIcons
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }

  plugins.forEach((plugin) => {
    app.use(plugin)
  })
}
